from django.views.generic import ListView
from django.views.generic.edit import CreateView

from .models import Gallery

# Create your views here.


class ListGallery(ListView):
    model = Gallery
    template_name = "gallery/list_file.html"
    context_object_name = "gallery_list"


# def storage_file(file):
#     with open(f'gallery_tmp/{file.name}', 'wb+') as new_file:
#         for chunk in file.chunks():


# class GalleryView(View):
#     def get(self, request):

#     def post(self, request):
#         if form.is_valid():


class CreateGalleryView(CreateView):
    model = Gallery
    template_name = "gallery/load_file.html"
    success_url = "load_image"
    fields = "__all__"
